<%--
  Created by IntelliJ IDEA.
  User: 王韫琛
  Date: 2021/1/27
  Time: 1:15
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>超级管理员发布公告</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/webjars/layui/2.5.6/css/layui.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/webjars/layui/2.5.6/layui.all.js">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/webjars/layui/2.5.6/layui.js">
</head>
<body>
<div style="text-align: center" id="form_body">
    <br>
    <fieldset class="layui-elem-field layui-field-title">
        <legend>普通管理员发布公告</legend>
    </fieldset>
    <br>
    <div class="layui-inline">
        <form  class="layui-form layui-form-pane" lay-filter="dataFrm" method="post">
            <div class="layui-form-item">
                <input type="hidden" name="id">
                <label class="layui-form-label" for="author">发布者姓名:</label>
                <div class="layui-input-block">
                    <input type="text" name="author" id="author" class="layui-input" required lay-verify="required"
                           lay-reqText="请输入发布者姓名" placeholder="请输入发布者姓名" autocomplete="off">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">发布者身份:</label>
                <div class="layui-input-block">
                    <select name="grade" lay-filter="aihao" disabled="disabled">
                        <option value="普通管理员">普通管理员</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label" for="title">公告标题:</label>
                <div class="layui-input-block">
                    <input type="text" name="title" id="title" class="layui-input" required lay-verify="required"
                           lay-reqText="请输入公告标题" placeholder="请输入公告标题" autocomplete="off">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label" for="test1">添加时间:</label>
                <div class="layui-input-block">
                    <input type="text" name="add_time" required lay-verify="required|data" class="layui-input"
                           lay-reqText="请输入日期" placeholder="请输入日期" id="test1">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label" for="content">公告内容:</label>
                    <div class="layui-input-block">
                        <textarea placeholder="请输入内容" id="content" name="content" class="layui-textarea"
                                  style="width: 775px;height: 300px"></textarea>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <button class="layui-btn" lay-submit lay-filter="doSubmit" lay-event="add">发布</button>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <button type="reset" class="layui-btn layui-btn-warm">重置</button>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript" src="${pageContext.request.contextPath}/webjars/layui/2.5.6/layui.js"></script>
<script>
    layui.use(['form', 'jquery', 'table', 'laydate', 'layer'], function () {
        var form = layui.form;
        var $ = layui.jquery;
        var layer = layui.layer;
        var laydate = layui.laydate;
        var url = "/AdminAnnMg";
        //日期控件开始
        laydate.render({
            elem: '#test1' //指定元素
            ,format: 'yyyy-MM-dd HH:mm:ss'
        });
        //日期控件结束

        //表单监听事件
        form.on("submit(doSubmit)", function (data) {
            $.post(url, data.field, function (result) {
                if (result.success) {
                    layer.alert(result.message, {icon: 1},function (index) {
                        location.href="/Admin_Main_Bull";
                        layer.close(index);
                    });
                } else {
                    layer.alert(result.message, {icon: 2});
                }
            }, "json");
            //禁止页面跳转
            return false;
        });
        //表单监听事件结束
    })
</script>
</body>
</html>
